﻿using System.Collections.Generic;

namespace BoneSystem.Extensions
{
    public class Events
    {
        public string OnClick { get; set; }
        public string OnKeyUp { get; set; }
        public string OnKeyDown { get; set; }
        public string OnKeyPress { get; set; }
        public string OnLoad { get; set; }
        public string OnUnLoad { get; set; }
        public string OnMouseHover { get; set; }
        public string OnMouseLeave { get; set; }

        public Dictionary<string, string> GetAttributes()
        {
            var ret = new Dictionary<string, string>();
            if (!string.IsNullOrEmpty(OnClick))
            {
                ret["onclick"] = OnClick;
            }
            if (!string.IsNullOrEmpty(OnKeyUp))
            {
                ret["onkeyup"] = OnKeyUp;
            }
            if (!string.IsNullOrEmpty(OnKeyDown))
            {
                ret["onkeydown"] = OnKeyDown;
            }
            if (!string.IsNullOrEmpty(OnKeyPress))
            {
                ret["onkeypress"] = OnKeyPress;
            }
            if (!string.IsNullOrEmpty(OnLoad))
            {
                ret["onload"] = OnLoad;
            }
            if (!string.IsNullOrEmpty(OnUnLoad))
            {
                ret["onunload"] = OnUnLoad;
            }
            if (!string.IsNullOrEmpty(OnMouseHover))
            {
                ret["onmousehover"] = OnMouseHover;
            }
            if (!string.IsNullOrEmpty(OnMouseLeave))
            {
                ret["onmouseleave"] = OnMouseLeave;
            }

            return ret;
        }
    }
}